# # 自定义json格式
# from flask import make_response, current_app, request
# from flask_restplus.utils import PY3
# from json import dumps
#
# def output_json(data, code, headers=None):
#     """Makes a Flask response with a JSON encoded body"""
#     # 自定义格式
#     if "message" not in data:
#         data = {"message": "OK", "data": data}
#
#     settings = current_app.config.get("RESTFUL_JSON", {})
#
#     if current_app.debug:
#         settings.setdefault("indent", 4)
#         settings.setdefault("sort_keys", not PY3)
#
#     # always end the json dumps with a new line
#     # see https://github.com/mitsuhiko/flask/pull/1262
#     dumped = dumps(data, **settings) + "\n"

# resp = make_response(dumped, code)
# resp.headers.extend(headers or {})
# return resp
